<template>
	<view class="content">
		<view class="too">
			<image src="https://sprtcar.oss-cn-chengdu.aliyuncs.com/images/bgImg.png" mode="widthFix"></image>
			<view class="toop">
				<view class="toop_a">
					<image :src="data.shops.photo" mode="" @click.stop="preview(data.shops.photo)"></image>
					<view class="toop_aa">
						<p class="tit_top">{{ data.shops.title }}</p>
						<view class="renzhen r">{{ data.shops.type }}</view>
					</view>
				</view>
				<view class="toop_b">
					<view class="toop_b_a">
						<p>{{ data.shops.dotey }}</p>
						<p>全部宝贝</p>
					</view>
					<view class="toop_b_a">
						<p>{{ data.shops.deal }}</p>
						<p>成交量</p>
					</view>
					<view class="toop_b_a">
						<p>{{ data.shops.views }}</p>
						<p>浏览量</p>
					</view>
				</view>
				<view class="toop_c">
					<view class="toop_c_a">
						<image src="../../../static/wezhi.png" mode=""></image>
						<span>{{ data.shops.site }}</span>
					</view>
					<view class="toop_c_b">已入驻{{ data.shops.nums }}</view>
				</view>
			</view>
		</view>
		<view class="changping">
			<view class="changping_top">
				<p class="changping_top_a">店铺产品</p>
				<p class="changping_top_b">更多 》</p>
			</view>
			<view class="changping_cen">
				<view class="changping_cen_a" style="padding-bottom: 25rpx;" v-for="(i, index) in data.product" :key="index" @click="shopProducts(i.id)">
					<image :src="i.cover" mode="aspectFill" @click.stop="preview(i.cover)"></image>
					<p class="changping_a">{{ i.name }}</p>
					<p class="changping_b">￥{{ i.price }}/天</p>
				</view>
			</view>
		</view>

		<view class="changping" style="margin-bottom: 100rpx;">
			<view class="changping_top">
				<p class="changping_top_a">活动案例</p>
				<p class="changping_top_b">更多 》</p>
			</view>
			<view class="changping_cen">
				<view class="changping_cen_a" v-for="(i, index) in data.activity" :key="index" @click="activity(i.id)">
					<image :src="i.cover" mode="" @click.stop="preview(i.cover)"></image>
					<p class="changping_a">{{ i.title }}</p>
				</view>
			</view>
		</view>

		<view class="bottom_a"><view class="bottom_a_a" @click="dialNum(data.shops.phone)">拨打电话</view></view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			id: '',
			data: {},
		};
	},
	onLoad(e) {
		e && (this.id = e.id);
		this.shopHm(e.id);
		uni.setNavigationBarColor({
			frontColor: '#ffffff',
			backgroundColor: '#ff0000',
			animation: {
				duration: 400,
				timingFunc: 'easeIn',
			},
		});
	},
	methods: {
		dialNum(phone) {
			uni.makePhoneCall({
				phoneNumber: phone,
			});
		},
		preview(urls) {
			uni.previewImage({
				urls: [urls],
				longPressActions: {
					itemList: ['发送给朋友', '保存图片', '收藏'],
					success: function(data) {
						console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
					},
					fail: function(err) {
						console.log(err.errMsg);
					},
				},
			});
		},
		async shopHm(sid) {
			let obj = {
				sid,
			};
			const res = await this.$u.post('api/shop/shop_index', obj, {});
			if (!res.code) return uni.$showMsg();
			this.data = res.data;
			console.log('店铺首页 >>  ', res);
		},
		// 案例
		activity(id) {
			wx.navigateTo({
				
				url: './anlei?id=' + id + '&sid=' + this.data.shops.id,
			});
		},
		// 店铺
		shopProducts(id) {
			wx.navigateTo({
				url: './changping?id=' + id+ '&dj_id=' + this.data.shops.id,
			});
		},
	},
};
</script>

<style lang="scss" scoped>
.content {
	width: 100%;
	height: 100%;
	background-color: #f5f8fd;
}
.too {
	width: 100%;
	height: 350rpx;
	position: relative;
	image {
		width: 100%;
		height: 350rpx;
	}
	.toop {
		width: 100%;
		height: 300rpx;
		position: absolute;
		top: 50rpx;
		.toop_a {
			width: 690rpx;
			margin: auto;
			height: 100rpx;
			display: flex;
			image {
				width: 100rpx;
				height: 100rpx;
			}
			.toop_aa {
				width: 550rpx;
				height: 100rpx;
				margin-left: 20rpx;
				.tit_top {
					width: 550rpx;
					height: 40rpx;
					color: #ffffff;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}
				.renzhen {
					display: flex;
					align-items: center;
					justify-content: center;
					width: 120rpx;
					height: 35rpx;
					background-color: #ff0000;
					color: #ffffff;
					font-size: 24rpx;

					margin-top: 20rpx;
				}
			}
		}
		.toop_b {
			// width: 690rpx;
			margin: auto;
			height: 100rpx;
			margin-top: 30rpx;
			display: flex;
			justify-content: space-around;
			.toop_b_a {
				width: 60px;
				height: 100rpx;
				color: #ffffff;
				p {
					width: 60px;
					text-align: center;
					font-size: 24rpx;
					margin-top: 10rpx;
				}
			}
		}
		.toop_c {
			width: 690rpx;
			margin: auto;
			height: 50rpx;
			margin-top: 20rpx;
			display: flex;
			justify-content: space-between;
			.toop_c_a {
				width: 480rpx;
				height: 50rpx;
				line-height: 50rpx;
				display: flex;
				image {
					width: 30rpx;
					height: 30rpx;
					margin-top: 10rpx;
				}
				span {
					display: block;
					width: 480rpx;
					color: #ffffff;
					font-size: 30rpx;
					margin-left: 10rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}
			}
			.toop_c_b {
				width: 200rpx;
				height: 50rpx;
				line-height: 50rpx;
				color: #ffffff;
				text-align: right;
				font-size: 24rpx;
			}
		}
	}
}
.changping {
	width: 100%;
	height: 100%;
	background-color: #ffffff;
	margin-top: 30rpx;
	//padding-bottom: 100rpx;
	.changping_top {
		width: 690rpx;
		height: 60rpx;
		margin: auto;
		display: flex;
		justify-content: space-between;
		.changping_top_a {
			color: #333333;
			width: 200rpx;
			height: 60rpx;
			line-height: 60rpx;
			font-size: 30rpx;
		}
		.changping_top_b {
			color: #999999;
			width: 200rpx;
			height: 60rpx;
			line-height: 60rpx;
			font-size: 24rpx;
			text-align: right;
		}
	}
	.changping_cen {
		width: 690rpx;
		margin: auto;
		height: 100%;
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
		.changping_cen_a {
			width: 330rpx;
			// padding-bottom: 25rpx;

			image {
				width: 330rpx;
				height: 200rpx;
				border-radius: 10rpx;
			}
			.changping_a {
				height: 24rpx;
				font-size: 26rpx;
				font-family: PingFang SC;
				font-weight: 600;
				color: #333333;
				margin: 25rpx 0;
				padding-left: 10rpx;
			}
			.changping_b {
				width: 330rpx;
				height: 30rpx;
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #ff0000;
				line-height: 40rpx;
				display: flex;
				justify-content: space-between;
				flex-wrap: wrap;
			}
		}
	}
}

.bottom_a {
	width: 100%;
	height: 110rpx;
	background-color: #ffffff;
	position: fixed;
	bottom: 0;
	.bottom_a_a {
		font-size: 36rpx;
		width: 690rpx;
		margin: auto;
		border-radius: 50rpx;
		background-color: #ff0000;
		height: 90rpx;
		line-height: 90rpx;
		margin-top: 10rpx;
		color: #ffffff;
		text-align: center;
	}
}
</style>
